
//
//  OCViewController.m
//  SwiftUITemp
//
//  Created by MyMac on 15/10/19.
//  Copyright (c) 2015年 tongfang. All rights reserved.
//

#import "OCViewController.h"
//swift调用oc文件，在调用的OC文件里面，导入一个固定文件名，实际就是将oc代码转化为swift代码
#import <SwiftUITemp-Swift.h>
@interface OCViewController()

@end
@implementation OCViewController
-(void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor redColor];
    UIButton*btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 100, 320, 44)];
    [btn setTitle:@"swift" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    

}
-(void)btnClick:(UIButton*)btn
{
    //OC调用Swift文件，不需要倒入swift的文件名
    SwiftVC*vc=[[SwiftVC alloc]init];
    [vc addTitle:@"swift"];
    [self.navigationController pushViewController:vc animated:YES];


}
-(void)addTitle:(NSString*)str{

    self.title=str;

}
@end
